﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MstartTemplate1.master" AutoEventWireup="true" CodeBehind="whishlist.aspx.cs" Inherits="WebSite1.whishlist" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 699px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent1" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <p><table border="0" cellpadding="0" cellspacing="0" width="95%" align="center" height="25" background="images/fon_bar01.gif">
          <tr>
            <td>
              <table border="0" cellpadding="0" cellspacing="0" background="" bgcolor="#FFFFFF">
                <tr>
                  <td><img src="images/e03.gif" width="21" height="21" alt="" border="0" align="left"></td>
                  <td>
                    <p class="bar01" style="color: #DA0008; font-size: 18px;">Select Items to put in WishList&nbsp;</p>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" 
            
            
            SelectCommand="SELECT user_whishlist.rec_id, user_whishlist.user_id, user_whishlist.wishlist_id, wishlists.created, wishlists.wishlistname, wishlists.wishlist_cat_id, wishlist_cat.cat_name, COUNT(wishlist_items.item_id) AS itemcnt FROM user_whishlist INNER JOIN wishlists ON user_whishlist.wishlist_id = wishlists.wishlist_id INNER JOIN wishlist_cat ON wishlists.wishlist_cat_id = wishlist_cat.cat_id INNER JOIN wishlist_items ON wishlists.wishlist_id = wishlist_items.wishlist_id WHERE (user_whishlist.user_id = @UserID) AND (user_whishlist.wishlist_id = @w_id) GROUP BY wishlist_cat.cat_name, wishlists.wishlist_cat_id, wishlists.wishlistname, wishlists.created, user_whishlist.wishlist_id, user_whishlist.user_id, user_whishlist.rec_id">
            <SelectParameters>
                <asp:SessionParameter DefaultValue="" Name="UserID" SessionField="UserID" />
                <asp:SessionParameter Name="w_id" SessionField="CurrentWishListID" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" ></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
            ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" 
            InsertCommand="INSERT INTO wishlist_items(wishlist_id, item_id) VALUES (@w, @i)" 
            SelectCommand="SELECT id FROM wishlist_items">
            <InsertParameters>
                <asp:SessionParameter Name="w" SessionField="CurrentWishListID" />
                <asp:Parameter Name="i" />
            </InsertParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
            ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>"            
            SelectCommand="SELECT wishlist_items.wishlist_id, items.id, items.url, items.title, items.price FROM items INNER JOIN wishlist_items ON items.id = wishlist_items.item_id WHERE (wishlist_items.wishlist_id = @wishlist_id)">
            <SelectParameters>
                <asp:SessionParameter Name="wishlist_id" SessionField="CurrentWishListID" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        <br />
        <table class="style1">
            <tr>
                <td class="style2">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                                DataKeyNames="rec_id" DataSourceID="SqlDataSource1" Font-Names="Verdana" 
                                ondatabound="GridView1_DataBound" onrowdatabound="GridView1_RowDataBound" 
                                onselectedindexchanged="GridView1_SelectedIndexChanged">
                                <Columns>
                                    <asp:BoundField DataField="wishlistname" HeaderText="wishlistname" />
                                    <asp:BoundField DataField="cat_name" HeaderText="cat_name" />
                                    <asp:BoundField DataField="wishlist_id" />
                                    <asp:BoundField DataField="itemcnt" />
                                    <asp:HyperLinkField DataNavigateUrlFields="wishlist_id" 
                                        DataNavigateUrlFormatString="mywhishlist.aspx?w_id={0}" DataTextField="itemcnt" 
                                        DataTextFormatString="&quot;{0} Items&quot;" />
                                </Columns>
                            </asp:GridView>
                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:bestgifts4usConnectionString %>" 
                                SelectCommand="SELECT * FROM [items]"></asp:SqlDataSource>
                            <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
           DataKeyNames="id" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" 
                        PageSize="4" CellPadding="4" ForeColor="#333333" 
    GridLines="None" Visible="False">
                                <AlternatingRowStyle BackColor="White" />
                                <Columns>
                                    <asp:BoundField DataField="title" HeaderText="Product" />
                                    <asp:TemplateField HeaderText="Link" SortExpression="url">
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("url") %>'></asp:TextBox>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Literal ID="L1" runat="server" Text='<%# Bind("url") %>'></asp:Literal>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="price" HeaderText="price" />
                                    <asp:TemplateField ShowHeader="False">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"  
                            CommandArgument ='<%# Eval("id")%>' OnCommand="LinkButton1_Click" 
                            Text="Select"></asp:LinkButton>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="id" HeaderText="id" Visible="False" />
                                </Columns>
                                <FooterStyle BackColor="#990000" ForeColor="White" Font-Bold="True" />
                                <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                                <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                                <SortedAscendingCellStyle BackColor="#FDF5AC" />
                                <SortedAscendingHeaderStyle BackColor="#4D0000" />
                                <SortedDescendingCellStyle BackColor="#FCF6C0" />
                                <SortedDescendingHeaderStyle BackColor="#820000" />
                            </asp:GridView>
                            <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2" 
                                GroupItemCount="3"   DataMember="DefaultView" 
                                onitemcommand="ListView1_ItemCommand">
                                <ItemTemplate>
                               <td id="Td1" runat="server" style="background-color: #FFFBD6;color: #333333;">
                                 
                                              <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td><img src="images/t_11.gif" width="10" height="9" alt="" border="0"></td>
                              <td background="images/t_13.gif"><img src="images/t_12.gif" width="6" height="9" alt="" border="0"></td>
                              <td background="images/t_13.gif" align="right"><img src="images/t_14.gif" width="6" height="9" alt="" border="0"></td>
                              <td><img src="images/t_15.gif" width="10" height="9" alt="" border="0"></td>
                            </tr>
                            <tr valign="top">
                              <td background="images/t_fon_left.gif"><img src="images/t_21.gif" width="10" height="6" alt="" border="0"></td>
                              <td rowspan="2" colspan="2">
                                <!-- in -->
                                <table border="0" cellpadding="0" cellspacing="0" width="255">
                                  <tr>
                                    <td><asp:Label ID="urlLabel2" runat="server" Text='<%# Eval("url") %>' />
                                     </td>
                                    <td>
                                      <p style="color: #1F86DE; font-size: 15px; padding-bottom: 0px;"><asp:Label ID="titleLabel2" runat="server" Text='<%# Eval("title") %>' /></p>
                                      <p style="color: #DA0008; font-size: 17px; padding-bottom: 5px;"><b>$ <asp:Label ID="priceLabel2" runat="server" Text='<%# Eval("price") %>' />
                                               <br /></b></p>
                                    </td>
                                  </tr>
                                </table>
                                <div align="right">
                                   <asp:LinkButton ID="LinkButton1"  runat="server" CausesValidation="False"  
                            CommandArgument ='<%# Eval("id")%>'  CommandName="AddItem"    
                            Text="Select" ><img src="images/b_buy.gif" width="45" height="24" alt="" border="0"></asp:LinkButton>
                            <img src="images/b_det.gif" width="75" height="24" alt="" border="0"></a>&nbsp;
                                </div><!-- /in -->
                              </td>
                              <td background="images/t_fon_right.gif"><img src="images/t_23.gif" width="10" height="6" alt="" border="0"></td>
                            </tr>
                            <tr valign="bottom">
                              <td background="images/t_fon_left.gif"><img src="images/t_31.gif" width="10" height="7" alt="" border="0"></td>
                              <td background="images/t_fon_right.gif"><img src="images/t_33.gif" width="10" height="7" alt="" border="0"></td>
                            </tr>
                            <tr>
                              <td><img src="images/t_41.gif" width="10" height="10" alt="" border="0"></td>
                              <td background="images/t_fon_bot.gif"><img src="images/t_42.gif" width="6" height="10" alt="" border="0"></td>
                              <td background="images/t_fon_bot.gif" align="right"><img src="images/t_44.gif" width="6" height="10" alt="" border="0"></td>
                              <td><img src="images/t_45.gif" width="10" height="10" alt="" border="0"></td>
                            </tr>
                          </table>  
                                  
                               </td>
                                </ItemTemplate>
                                <AlternatingItemTemplate>
                                <td runat="server" style="background-color: #FAFAD2;color: #284775;">

                                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                              <td><img src="images/t_11.gif" width="10" height="9" alt="" border="0"></td>
                              <td background="images/t_13.gif"><img src="images/t_12.gif" width="6" height="9" alt="" border="0"></td>
                              <td background="images/t_13.gif" align="right"><img src="images/t_14.gif" width="6" height="9" alt="" border="0"></td>
                              <td><img src="images/t_15.gif" width="10" height="9" alt="" border="0"></td>
                            </tr>
                            <tr valign="top">
                              <td background="images/t_fon_left.gif"><img src="images/t_21.gif" width="10" height="6" alt="" border="0"></td>
                              <td rowspan="2" colspan="2">
                                <!-- in -->
                                <table border="0" cellpadding="0" cellspacing="0" width="255">
                                  <tr>
                                    <td><asp:Label ID="urlLabel2" runat="server" Text='<%# Eval("url") %>' />
                                     </td>
                                    <td>
                                      <p style="color: #1F86DE; font-size: 15px; padding-bottom: 0px;"><asp:Label ID="titleLabel2" runat="server" Text='<%# Eval("title") %>' /></p>
                                      <p style="color: #DA0008; font-size: 17px; padding-bottom: 5px;"><b>$ <asp:Label ID="priceLabel2" runat="server" Text='<%# Eval("price") %>' />
                                               <br /></b></p>
                                    </td>
                                  </tr>
                                </table>
                                <div align="right">
                                  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"  
                            CommandArgument ='<%# Eval("id")%>'   CommandName="AddItem"    
                            Text="Select"><img src="images/b_buy.gif" width="45" height="24" alt="" border="0"></asp:LinkButton> <a href=""><img src="images/b_det.gif" width="75" height="24" alt="" border="0"></a>&nbsp;
                                </div><!-- /in -->
                              </td>
                              <td background="images/t_fon_right.gif"><img src="images/t_23.gif" width="10" height="6" alt="" border="0"></td>
                            </tr>
                            <tr valign="bottom">
                              <td background="images/t_fon_left.gif"><img src="images/t_31.gif" width="10" height="7" alt="" border="0"></td>
                              <td background="images/t_fon_right.gif"><img src="images/t_33.gif" width="10" height="7" alt="" border="0"></td>
                            </tr>
                            <tr>
                              <td><img src="images/t_41.gif" width="10" height="10" alt="" border="0"></td>
                              <td background="images/t_fon_bot.gif"><img src="images/t_42.gif" width="6" height="10" alt="" border="0"></td>
                              <td background="images/t_fon_bot.gif" align="right"><img src="images/t_44.gif" width="6" height="10" alt="" border="0"></td>
                              <td><img src="images/t_45.gif" width="10" height="10" alt="" border="0"></td>
                            </tr>
                          </table>  
                                        
                                    </td>
                                </AlternatingItemTemplate>
                                <EditItemTemplate>
                                  </EditItemTemplate>
                                <EmptyDataTemplate>
                                    <table runat="server" 
                                        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                                        <tr>
                                            <td>
                                                No data was returned.</td>
                                        </tr>
                                    </table>
                                </EmptyDataTemplate>
                                <EmptyItemTemplate>
                                    <td runat="server" />
                                </EmptyItemTemplate>
                                <GroupTemplate>
                                    <tr ID="itemPlaceholderContainer" runat="server">
                                        <td ID="itemPlaceholder" runat="server">
                                        </td>
                                    </tr>
                                </GroupTemplate>
                                <InsertItemTemplate>
                                </InsertItemTemplate>
                                <LayoutTemplate>
                                    <table border=0  runat="server">
                                        <tr runat="server">
                                            <td runat="server">
                                                <table ID="groupPlaceholderContainer" runat="server" border="0" 
                                                    style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                                    <tr ID="groupPlaceholder" runat="server">
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <tr runat="server">
                                            <td runat="server" 
                                                style="text-align: center;background-color: #FFCC66;font-family: Verdana, Arial, Helvetica, sans-serif;color: #333333;">
                                                <asp:DataPager ID="DataPager1"  runat="server"  PageSize="6">
                                                    <Fields>
                                                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                                            ShowLastPageButton="True" />
                                                    </Fields>
                                                </asp:DataPager>
                                            </td>
                                        </tr>
                                    </table>
                                </LayoutTemplate>
                                <SelectedItemTemplate>
                                    <td runat="server" 
                                        style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                                           <asp:Label ID="urlLabel" runat="server" Text='<%# Eval("url") %>' />
                                        <br />
                                        <asp:Label ID="titleLabel" runat="server" Text='<%# Eval("title") %>' />
                                        <br />
                                        price:
                                        <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                                        <br />

                                    </td>
                                </SelectedItemTemplate>
                            </asp:ListView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
        <br />
        <br />
    </p>
</asp:Content>
